<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>易买网 - 首页</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="scripts/function.js"></script>
<script type="text/javascript" src="./js/jQery-3.6.0.min.js"></script>
<script type="text/javascript" src="./js/vue.js"></script>
</head>
<body>
<div id="header" class="wrap">
	<div id="logo"><img src="images/logo.gif" /></div>
	<div class="help"><a href="#" class="shopping">购物车</a><a href="login.html">登录</a><a href="register.html">注册</a><a href="guestbook.html">留言</a></div>
	<div class="navbar">
		<ul class="clearfix">
			<li class="current"><a href="#">首页</a></li>
			<li><a href="#">图书</a></li>
			<li><a href="#">百货</a></li>
			<li><a href="#">品牌</a></li>
			<li><a href="#">促销</a></li>
		</ul>
	</div>
</div>
<div id="childNav">
	<div class="wrap">
		<ul class="clearfix">
			<li class="first"><a href="#">音乐</a></li>
			<li><a href="#">影视</a></li>
			<li><a href="#">少儿</a></li>
			<li><a href="#">动漫</a></li>
			<li><a href="#">小说</a></li>
			<li><a href="#">外语</a></li>
			<li><a href="#">数码相机</a></li>
			<li><a href="#">笔记本</a></li>
			<li><a href="#">羽绒服</a></li>
			<li><a href="#">秋冬靴</a></li>
			<li><a href="#">运动鞋</a></li>
			<li><a href="#">美容护肤</a></li>
			<li><a href="#">家纺用品</a></li>
			<li><a href="#">婴幼奶粉</a></li>
			<li><a href="#">饰品</a></li>
			<li class="last"><a href="#">Investor Relations</a></li>
		</ul>
	</div>
</div>
<div id="position" class="wrap">
	您现在的位置：<a href="index.jsp">易买网</a> &gt; 在线留言
</div>
<div id="main" class="wrap">
	<div class="lefter">
		<div class="box">
			<h2>商品分类</h2>
			<dl>
				<dt>图书音像</dt>
				<dd><a href="product-list.jsp">图书</a></dd>
				<dd><a href="product-list.jsp">音乐</a></dd>
				<dt>百货</dt>
				<dd><a href="product-list.jsp">运动健康</a></dd>
				<dd><a href="product-list.jsp">服装</a></dd>
				<dd><a href="product-list.jsp">家居</a></dd>
				<dd><a href="product-list.jsp">美妆</a></dd>
				<dd><a href="product-list.jsp">母婴</a></dd>
				<dd><a href="product-list.jsp">食品</a></dd>
				<dd><a href="product-list.jsp">手机数码</a></dd>
				<dd><a href="product-list.jsp">家具首饰</a></dd>
				<dd><a href="product-list.jsp">手表饰品</a></dd>
				<dd><a href="product-list.jsp">鞋包</a></dd>
				<dd><a href="product-list.jsp">家电</a></dd>
				<dd><a href="product-list.jsp">电脑办公</a></dd>
				<dd><a href="product-list.jsp">玩具文具</a></dd>
				<dd><a href="product-list.jsp">汽车用品</a></dd>
			</dl>
		</div>
	</div>
	<div class="main" id="app">
		<div class="guestbook">
			<h2>全部留言</h2>
			<ul>
				<li v-for="(item,index) in result">
					<dl>
						<dt>{{item.title}}</dt>
						<dd class="author">网友：{{item.nickname}} <span class="timer">{{item.createtime}}</span></dd>
						<dd>{{item.reply}}</dd>
					</dl>
				</li>
			</ul>
			<div class="clear"></div>
			<div class="pager">
				<!--<ul class="clearfix">
					<li><a href="#">上一页</a></li>
					<li class="current">1</li>
					<li><a href="#">2</a></li>
					<li><a href="#">3</a></li>
					<li><a href="#">4</a></li>
					<li><a href="#">5</a></li>
					<li><a href="#">下一页</a></li>
				</ul>-->
			</div>
			<div id="reply-box">
				<form onsubmit="checkForm(frm)" >
					<table>
						<tr>
							<td class="field">昵称：</td>
							<td><input class="text" type="text" name="nickname" id="nickname"/></td>
						</tr>
						<tr>
							<td class="field">留言标题：</td>
							<td><input class="text" type="text" name="title" id="title"/></td>
						</tr>
						<tr>
							<td class="field">留言内容：</td>
							<td><textarea name="content" id="content"></textarea></td>
						</tr>
						<tr>
							<td></td>
							<td><label class="ui-blue">
								<input type="button" name="submit" value="提交留言" onclick="addComment()" />
							</label></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="footer">
	Copyright &copy; 2010 北大青鸟 All Rights Reserved. 京ICP证1000001号
</div>
</body>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			result: []
		},
	});
	$(function (){
		$.ajax({
			type: "get",
			url:"admin/commentAjax",
			success:function (data){
				let parse = JSON.parse(data);
				app.result="";
				app.result=parse;
			}
		})
	});
	function addComment(){
		$.ajax({
			type:"post",
			url:"admin/addComment",
			data:{
				nickname:$('#nickname').val(),
				title:$('#title').val(),
				content:$('#content').val()
			},
			success:function (data){
				console.log(data)
				if (data=="true"){
					document.location.href ="/shopping-result.html";
				}
			}
		})
		$('#nickname').val("");
		$('#title').val("")
		$('#content').val("")

	}

</script>
</html>
